<template>
    <view class="">
        <custom title="信友圈详情" mode="2" fixed="fixed" :pageBack="true" @goback="goback"></custom>
		<frienditem  :info="info" :isDetail="true" @refresh="getInfo">
		</frienditem>
		<fixed-line></fixed-line>
		<common></common>
    </view>
</template>

<script>
import { getFriendCircleDetail } from './api/friendCircle'
import { timestampToTime } from '../../pages/course/utils'
import frienditem from './frienditem.vue';
export default {
    name: 'FgxUniappDetail',
    components: { frienditem },
    data() {
        return {
            info: {
                userInfo:{}
            },
            id: 0
        };
    },
    onLoad({id}) {
        this.id = id
        this.getInfo()
    },
    methods: {
        goback() {
            uni.$emit('updateDetail', this.id)
            this.uniBack()
        },
        async getInfo() {
            const { data } = await getFriendCircleDetail({ id: this.id }, false)
            this.info = data
            this.info.userInfo = {
                avatarUrl: data.avatarUrl,
                name: data.remark,
                time: timestampToTime(data.createTime, 'Mm')
            }
            if(this.info.commentDtos && this.info.commentDtos.length > 0) {
                this.info.commentDtos.forEach(item => {
                item.createTime = timestampToTime(data.createTime)
                item.isDelete = item.userId == this.user_info.id
            })
            }   
            
        }
    },
};
</script>

<style lang="scss">
page {
    background-color: #f5f6f7;
}
</style>